<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "employee".
 *
 * @property integer $id
 * @property string $name
 * @property string $number
 * @property integer $gender
 * @property string $birthday
 * @property string $email
 * @property string $mobile
 * @property string $weixin
 * @property string $id_card_num
 * @property string $native_place
 * @property string $blood_type
 * @property string $wed_status
 * @property string $nationality
 * @property string $folk
 * @property string $hklx
 * @property string $position_number
 * @property string $position_name
 * @property string $department_number
 * @property string $department_name
 * @property string $department_display_name
 * @property string $labor_relation_state
 * @property string $hr_id
 * @property integer $hr_status
 * @property string $mdm_id
 * @property integer $mdm_status
 * @property string $memo
 * @property string $created_by
 * @property string $created_at
 * @property string $updated_by
 * @property string $updated_at
 */
class Employee extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'employee';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['name', 'number'], 'required'],
            [['gender', 'hr_status', 'mdm_status'], 'integer'],
            [['created_at', 'updated_at'], 'safe'],
            [['name', 'number', 'birthday', 'email', 'mobile', 'id_card_num', 'native_place', 'blood_type', 'wed_status', 'nationality', 'folk', 'hklx', 'position_number', 'department_number', 'labor_relation_state', 'hr_id', 'mdm_id', 'created_by', 'updated_by'], 'string', 'max' => 45],
            [['weixin', 'position_name', 'department_name', 'department_display_name'], 'string', 'max' => 255],
            [['memo'], 'string', 'max' => 2048],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('app', 'ID'),
            'name' => Yii::t('app', 'Name'),
            'number' => Yii::t('app', 'Number'),
            'gender' => Yii::t('app', 'Gender'),
            'birthday' => Yii::t('app', 'Birthday'),
            'email' => Yii::t('app', 'Email'),
            'mobile' => Yii::t('app', 'Mobile'),
            'weixin' => Yii::t('app', 'Weixin'),
            'id_card_num' => Yii::t('app', 'Id Card Num'),
            'native_place' => Yii::t('app', 'Native Place'),
            'blood_type' => Yii::t('app', 'Blood Type'),
            'wed_status' => Yii::t('app', 'Wed Status'),
            'nationality' => Yii::t('app', 'Nationality'),
            'folk' => Yii::t('app', 'Folk'),
            'hklx' => Yii::t('app', 'Hklx'),
            'position_number' => Yii::t('app', 'Position Number'),
            'position_name' => Yii::t('app', 'Position Name'),
            'department_number' => Yii::t('app', 'Department Number'),
            'department_name' => Yii::t('app', 'Department Name'),
            'department_display_name' => Yii::t('app', 'Department Display Name'),
            'labor_relation_state' => Yii::t('app', 'Labor Relation State'),
            'hr_id' => Yii::t('app', 'Hr ID'),
            'hr_status' => Yii::t('app', 'Hr Status'),
            'mdm_id' => Yii::t('app', 'Mdm ID'),
            'mdm_status' => Yii::t('app', 'Mdm Status'),
            'memo' => Yii::t('app', 'Memo'),
            'created_by' => Yii::t('app', 'Created By'),
            'created_at' => Yii::t('app', 'Created At'),
            'updated_by' => Yii::t('app', 'Updated By'),
            'updated_at' => Yii::t('app', 'Updated At'),
        ];
    }

    public function getPrintName(){
        return sprintf('姓名: %s 工号: %s', $this->name, $this->number);
    }
}
